package xyz.ddlnt.servicemq.listener;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import xyz.ddlnt.model.dto.UserContentInteractionDTO;
import xyz.ddlnt.servicemq.service.MessageService;

import java.util.Map;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/26 16:54
 */
@Slf4j
@Component
public class MessageListener {
    @Resource
    private MessageService messageService;

    /**
     * 新增消息
     * @param map
     */
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "message_plus_one"),
            exchange = @Exchange(name =  "usr.message"),
            key = "message_plus_one"
    ))
    public void messagePlusOne(Map<String, String> map) {
        log.info("开始：新增消息");
        messageService.messagePlusOne(map);
        log.info("新增消息");
    }
}
